package com.yang.frost.blueberry.config.properties;

import com.yang.frost.blueberry.enums.LogPrintType;
import com.yang.frost.blueberry.enums.RequestIdType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @author 10296
 * @date 2021/1/21
 * @Description:
 */
@Component
@ConfigurationProperties(prefix = "blueberry.aop")
public class LogAopProperties {

    /**
     * 是否启用日志配置
     */
    private boolean enable =true;
    /**
     * 是否启用requestId
     */
//    @Value("blueberry.aop.log.enable-request-id")
    private Boolean enableRequestId = true;

    /**
     * 日志输出类型
     */
//    @Value("blueberry.aop.log.log-print-type")
    private LogPrintType logPrintType = LogPrintType.ORDER;
    /**
     * 请求ID生成类型
     */
//    @Value("blueberry.aop.log.request-id-type")
    private RequestIdType requestIdType = RequestIdType.IDWORK;
    /**
     * 请求日志在控制台是否格式化输出，local环境建议开启，服务器环境设置为false
     */
    private boolean requestLogFormat = true;
    /**
     * 相应日志在控制台是否格式化输出，local环境建议开启，服务器环境设置为false
     */
    private boolean responseLogFormat = true;
    /**
     * 排除路径
     */
    @Value("blueberry.aop.log.exclude-paths")
    private Set<String> excludePaths;

    /*操作日志配置*/

    /**
     * 是否启用操作日志配置
     */
//    @Value("blueberry.aop.log.enable")
    private boolean operationEnable = true;
    /**
     * 排除路径
     */
    @Value("blueberry.aop.operation-log.exclude-paths")
    private Set<String> operationExcludePaths;

    /*登录日志配置*/

    /**
     * 是否启用登录日志
     */
//    @Value("blueberry.aop.login-log.enable")
    private boolean loginEnable = true;
    /**
     * 登录路径
     */
//    @Value("blueberry.aop.login-log.login-path")
    private String loginPath = "systemApi/login";
    /**
     * 退出登录路径
     */
//    @Value("blueberry.aop.login-log.logout-path")
    private String logoutPath = "systemApi/logout";

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public boolean isEnableRequestId() {
        return enableRequestId;
    }

    public void setEnableRequestId(boolean enableRequestId) {
        this.enableRequestId = enableRequestId;
    }

    public LogPrintType getLogPrintType() {
        return logPrintType;
    }

    public void setLogPrintType(LogPrintType logPrintType) {
        this.logPrintType = logPrintType;
    }

    public RequestIdType getRequestIdType() {
        return requestIdType;
    }

    public void setRequestIdType(RequestIdType requestIdType) {
        this.requestIdType = requestIdType;
    }

    public boolean isRequestLogFormat() {
        return requestLogFormat;
    }

    public void setRequestLogFormat(boolean requestLogFormat) {
        this.requestLogFormat = requestLogFormat;
    }

    public boolean isResponseLogFormat() {
        return responseLogFormat;
    }

    public void setResponseLogFormat(boolean responseLogFormat) {
        this.responseLogFormat = responseLogFormat;
    }

    public Set<String> getExcludePaths() {
        return excludePaths;
    }

    public void setExcludePaths(Set<String> excludePaths) {
        this.excludePaths = excludePaths;
    }

    public boolean isOperationEnable() {
        return operationEnable;
    }

    public void setOperationEnable(boolean operationEnable) {
        this.operationEnable = operationEnable;
    }

    public Set<String> getOperationExcludePaths() {
        return operationExcludePaths;
    }

    public void setOperationExcludePaths(Set<String> operationExcludePaths) {
        this.operationExcludePaths = operationExcludePaths;
    }

    public boolean isLoginEnable() {
        return loginEnable;
    }

    public void setLoginEnable(boolean loginEnable) {
        this.loginEnable = loginEnable;
    }

    public String getLoginPath() {
        return loginPath;
    }

    public void setLoginPath(String loginPath) {
        this.loginPath = loginPath;
    }

    public String getLogoutPath() {
        return logoutPath;
    }

    public void setLogoutPath(String logoutPath) {
        this.logoutPath = logoutPath;
    }
}
